# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Christian Rebischke <echo Q2hyaXMuUmViaXNjaGtlQGdtYWlsLmNvbQo= | base64 -d>

pkgname=peda
pkgver=1.2
pkgrel=3
pkgdesc='Python Exploit Development Assistance for GDB'
url='https://github.com/longld/peda'
arch=('any')
license=('custom:Creative Commons')
depends=('gdb' 'binutils' 'nasm' 'python-six')
source=(https://github.com/longld/peda/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('e69844b8c3a51af96096d97ebfa4a67ac8ff16e4a9e0edb64bbb5e946b1ebeaa56260663718b90145f4191cc25762f3e351a8de92bf9b56f9f1d11389c563c43')
b2sums=('6942b99d714eb1114167b80ba202d86f6dee52cd47c8047b4cb78d4a91f45e1594521440a3318a968e35c5dc56a616393c0837d6f9db5ba41505641a385fb573')

prepare() {
  cd ${pkgname}-${pkgver}
  rm lib/six.py
  sed '/git clone/d' -i README.md
  sed 's|~/peda/peda.py|/usr/share/peda/peda.py|g' -i README.md
}

build() {
  cd ${pkgname}-${pkgver}
  echo 'Compiling python objects...'
  python -m compileall . >/dev/null
  python -O -m compileall . >/dev/null
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 644 *.py -t "${pkgdir}/usr/share/${pkgname}"
  install -Dm 644 __pycache__/* -t "${pkgdir}/usr/share/${pkgname}/__pycache__"
  install -Dm 644 lib/*.py -t "${pkgdir}/usr/share/${pkgname}/lib"
  install -Dm 644 lib/__pycache__/* -t "${pkgdir}/usr/share/${pkgname}/lib/__pycache__"
  install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm 644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}

# vim: ts=2 sw=2 et:
